<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .redBox {
            height: 100px;
            width: 100px;
            background-color: red;
        }
        
        input {
            outline: none;
        }
    </style>
</head>

<body>
    <div class="redBox"></div>
    <input>
</body>
<script>
    var redBox = document.querySelector('.redBox');
    //点击事件不能传参数
    //但是调用的函数 有一个形参就够了 
    //这个形参代表是你点击的事件对象
    redBox.addEventListener('click', log);

    function log(abc) {
        abc = abc || window.event
        console.log('this is redBox');
        console.log(abc);
        console.log(name1);
        console.log(name2);
    }
    //页面加载调用函数是没有点击事件。
    //第一实参对应着函数的第一个形参
    log(45, 67);
</script>

</html>